#ifndef __KEY_H
#define __KEY_H

#include "stm32f1xx_hal.h"
#include <stdbool.h>

struct key_s
{
	bool key_up;
	bool key0;
	bool key1;
	bool key2;
	uint8_t all;
};

extern struct key_s keyflag;

#define KEY_UP  HAL_GPIO_ReadPin(KEY_UP_GPIO_Port, KEY_UP_Pin)
#define KEY0    HAL_GPIO_ReadPin(KEY0_GPIO_Port, KEY0_Pin)
#define KEY1    HAL_GPIO_ReadPin(KEY1_GPIO_Port, KEY1_Pin)
#define KEY2    HAL_GPIO_ReadPin(KEY2_GPIO_Port, KEY2_Pin)

void KEY_Scan(void);

#endif
